<%= stylesheet_link_tag "basic_info" %>
<%= stylesheet_link_tag "users" %>
<%= javascript_include_tag "users" %>

<div id="notice" class="notice"><%= notice %></div>

<div class="middle">
  <div class="web-title">
    <span>用户资料修改</span>
  </div>
  <% if @user.errors.any? %>
      <div id="error_explanation">
        <h2><%= pluralize(@user.errors.count, "error") %> prohibited this shipper from being saved:</h2>

        <ul>
          <% @user.errors.full_messages.each do |msg| %>
              <li><%= msg %></li>
          <% end %>
        </ul>
      </div>
  <% end %>

  <!-- the tabs -->
  <div class="edit-tabs">
    <a class="edit-tab inline-block tab-selected" href="###" id="b_i" style="margin-left: 20px;">
      <%= t 'activerecord.attributes.user.change_information' %>
    </a>
    <a class="edit-tab inline-block" href="###" id="c_p">
      <%= t 'activerecord.attributes.user.change_password' %>
    </a>
  </div>

  <div class="right_btn_div">
    <%= link_to (t 'common.show'), @user, {:confirm => (t 'common.confirm_quit'), :class => "inline-block s-btn"} %>
    <%#= link_to (t 'common.back'), users_path, {:confirm => (t 'common.confirm_quit'), :class => "inline-block s-btn"} %>
  </div>

  <%= hidden_field_tag :resultTap, "#{@resultTap}" %>

  <!-- tab "panes" -->
  <%= form_for @user, :html => {:id => "basic_form"} do |f| %>
      <%= hidden_field_tag :tap, "basic" %>
      <div id="edit_basic_info">
        <table class="edit_table" cellpadding="0" cellspacing="6">
          <tr>
            <td style="width: 150px"><%= f.label(t 'activerecord.attributes.user.login') %></td>
            <td>
              <%= f.text_field :login, {:disabled => true} %>
              <span><%= @user.diy_error_msg :login %></span>
            </td>
          </tr>
          <% if sys_admin? %>
              <tr>
                <td><%= f.label(t 'activerecord.attributes.user.biz_unit') %></td>
                <td>
                  <span><%= f.select :biz_unit_id, BizUnit.all.collect { |biz_unit| [biz_unit.name, biz_unit.id] } %></span>
                </td>
              </tr>
              <tr>
                <td><%= f.label(t 'activerecord.attributes.user.role') %></td>
                <td>
                  <span><%= f.select :role_id, Role.all.collect { |role| [role.name, role.id] } %></span></td>
              </tr>
          <% end %>
          <tr>
            <td><%= f.label(t 'activerecord.attributes.user.email') %></td>
            <td><%= f.text_field :email %>
              <span id="user_email_msg"><%= @user.diy_error_msg :email %></span>
              <%= f.text_field :email,{:name=>"hide_email",:class=> "old", :style => 'display:none'} %></td>
          </tr>
          <tr>
            <td><%= f.label(t 'activerecord.attributes.user.comment') %></td>
            <td>
              <%= f.text_field :comment %>
              <span><%= @user.diy_error_msg :comment %></span>
              <%= f.text_field :comment, {:name=> "hide_comment",:class=> "old",:style => 'display:none'} %></td>
            </td>
          </tr>
          <tr>
            <td></td>
            <td><a href="###" id="u_basic_sure" class="inline-block link-btn">保存</a></td>
          </tr>
        </table>
      </div>
  <% end %>

  <%= form_for @user, :html => {:id => "password_form"} do |f| %>
      <%= hidden_field_tag :tap, "password" %>
      <div id="change_password" class="hide">
        <table class="edit_table" cellpadding="0" cellspacing="6">
          <tr>
            <td style="width: 150px"><%= f.label(t 'activerecord.attributes.user.password') %></td>
            <td><%= f.password_field :password %>
              <span id="user_password_msg"><%= @user.diy_error_msg :password %></span></td>
          </tr>
          <tr>
            <td><%= f.label(t 'activerecord.attributes.user.password_confirmation') %></td>
            <td><%= f.password_field :password_confirmation %>
              <span id="user_password_confirmation_msg"><%= @user.diy_error_msg :password_confirmation %></span></td>
          </tr>
          <tr>
            <td></td>
            <td><a href="###" id="u_password_sure" class="inline-block link-btn">保存</a></td>
          </tr>
        </table>
      </div>
  <% end %>

</div>
